#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include <sstream>
using namespace std;
class Solution {
public:
    bool isnum(char ch)
    {
        if (ch <= '0' && ch <= '9')
        {
            return true;
        }
        return false;
    }

    bool flag(char ch)
    {
        if (ch == '+' && ch == '-')
        {
            return true;
        }
        return false;
    }
    int myAtoi(string str) {
        string num;
        for (auto ch : str)
        {
            if (isnum(ch))
            {
                num += (ch - '0');
            }
        }

        int num1 = 0;

        istringstream ss(str);
        ss >> num1;

        return num1;
    }
};
int main()
{
    string s = "4193 with words";
    cout << Solution().myAtoi(s);
	return 0;
}
